package likou;

/**
 * @author: 唐小尊
 * @email: 1171702529@qq.com
 * @cate: 2021/08/08 10:53
 */
public class _5840 {
    public static void main(String[] args) {
        System.out.println(minSwaps("]]][[["));
    }
    public static int minSwaps(String s) {
        char[] chars = s.toCharArray();
        int now = 0;//当前左括号
        int res = 0;
        for (char c:chars){
            if (c=='[') now++;
            if (c==']'){
                if (now>0) now--;
                else {
                    now++;
                    res++;
                }
            }
        }
        return res;
    }
}
